var url = serverPre + "/manager/scs/v2/signLog/list";

var bsConf = {

    queryFormId: "signlog-query-form",

    tableID: "id",

    queryCols: 3,

    queryFloat: "right",

    voName: "signLogVo",
    initData: true,
    // needChangeTab: true,
    //
    // needInitECharts: true,

    queryConfigs:                   //页面头部查询form
        [
            {
                type: 'text',
                placeholder: '流水号',
                label: '流水号',
                name: 'requestSN',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                placeholder: '模板编号',
                label: '模板编号',
                name: 'templateNo',
                default: '',
                verify: ''
            },
            {
                type: 'text',
                placeholder: '模板名称',
                label: '模板名称',
                name: 'templateName',
                default: '',
                verify: ''
            },
            {
                type: 'select',
                placeholder: '签章类型',
                label: '签章类型',
                name: 'signType',
                cols: [["",""],[1, '私章'],[2, '公章'],[3,'公私章']]
            },
            {
                type: 'select',
                placeholder: '签章状态',
                label: '签章状态',
                name: 'signStatus',
                cols: [["",""],[0, '未处理'],[1, '签章中'],[2, '签章成功'],[3, '签章失败']]
            },
            {
                type: 'select',
                placeholder: '是否签章',
                label: '是否签章',
                name: 'needSign',
                cols: [["",""], [1, '是'],[2,'否']]
            },

            {
                type: 'datetimerange',
                placeholder: '签章时间',
                label: '签章时间',
                name: 'timeRange',
                default: '',
                verify: ''
            },
            {
                type: 'select',
                id :'zh',
                placeholder: '租户',
                label: '租户',
                name: 'companyId',
                idProperty:"companyId",
                verify:"companyId_zh",
                dataUrl:serverPre+"/manager/scs/v2/company",
                nameProperty: 'companyAbbrName'
            },
            {
                type: 'select',
                placeholder: '产品',
                label: '产品',
                id:"cp",
                name: 'code',
                idProperty:"code",
                dataUrl:serverPre+"/manager/scs/v2/product",
                nameProperty: 'productName'
            },
            {
                type: 'select',
                placeholder: '管理员',
                label: '管理员',
                id:"gly",
                name: 'userId',
                idProperty:"userId",
                dataUrl:serverPre+"/manager/scs/v2/product/user",
                nameProperty: 'userName'
            },
            // {
            //     type: 'select',
            //     placeholder: '回执状态',
            //     label: '回执状态',
            //     name: 'callbackSts',
            //     cols: [["",""],[0, '待回执'],[1, '回执成功'],[2, '回执失败'],[3, '其他']]
            // }
        ],

    //列表内容
    tableCols: [
        {field: 'id', title: '序号', type: 'numbers'}
        , {field: 'requestSN', title: '流水号', width: '260', align: 'center'}
        , {field: 'templateNo', title: '模板编号', width: '200', align: 'center'}
        , {field: 'templateName', title: '模板名称', width: '260',align: 'center'}
        , {field: 'sealType', title: '签章类型', width: '100',align: 'center'}
        , {field: 'needSign', title: '是否签章', width: '100',align: 'center'}
        , {field: 'signTime', title: '请求签章时间',width: '200',align: 'center'}
        , {field: 'lastTime', title: '耗时',width: '150',align: 'center',templet: function (d) {return calculateTime(d.lastTime);}}
        , {field: 'callbackName', title: '回执状态', width: '100',align: 'center'}
        , {field: 'callBackTimes', title: '重调次数',width: '100',align: 'center'}
        , {field: 'signStatus', title: '签章状态', width: '100',align: 'center'}
        , {field: 'signResult', title: '签章结果', width: '100',align: 'center'}
        , {field: 'thirdPartyChannel', title: '签章渠道', width: '100',align: 'center'}
        , {field: 'callbackUrl', title: '业务回调地址', width: '250',align: 'center'}
        , {fixed: 'right', width: '100', title: '操作', align: 'center', toolbar: '#bar'}
    ],
    bindOwnTableEventCol: function (layEvent, data) {
        if (layEvent === 'preview') {
            if (data.signatureStatus === 0 || data.signatureStatus=== 1) {
                layer.alert('该状态下的记录无法预览', {
                    icon: 1,
                    skin: 'layer-ext-moon'
                });
            } else {
                xadmin.open("预览记录","../../signLog/preview.html?id="+data.id+"&signatureStatus="+data.signatureStatus+
                    "&contractUri="+data.contractUri+"&channelNo="+data.channelNo+"&createTime="+data.createTime, $(window).width()*0.4,$(window).height()*0.7);
            }
        }
    }

}

function query_search() {
    if ($("#up").hasClass("layui-icon-down")) {
        document.getElementById('up').classList.add("layui-icon-up");
        document.getElementById('up').classList.remove("layui-icon-down");
    }else{
        document.getElementById('up').classList.add("layui-icon-down");
        document.getElementById('up').classList.remove("layui-icon-up");
    }
    $("#product-query-form").toggle()
}
